var vod_big_class = '-4-0-0-0-0-0-0-0-0'
//var last_page;
//module.exports = {

// type: 'list',
// title: '香蕉->类型选择',

//}
module.exports = {
  type: 'list',
  title: '玉米->类型选择',
  actions: [
    {
      title: '制服诱惑',
      onClick: async function () {
        vod_big_class = '-5-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    },
    {
      title: '清纯少女',
      onClick: async function () {
        vod_big_class = '-6-0-0-0-0-0-0-0-0'
        last_page = null
        this.refresh()
      }
    },
    {
      title: '辣妹大奶',
      onClick: async function () {
        vod_big_class = '-7-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    },
    {
      title: '女同专属',
      onClick: async function () {
        vod_big_class = '-8-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    },
    {
      title: '素人演出',
      onClick: async function () {
        vod_big_class = '-9-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    },
    {
      title: '角色扮演',
      onClick: async function () {
        vod_big_class = '-10-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    },
    {
      title: '成人动漫',
      onClick: async function () {
        vod_big_class = '-11-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    }
    ,
    {
      title: '人妻熟女',
      onClick: async function () {
        vod_big_class = '-12-0-0-0-0-0-0-0-0'
        this.refresh()
      }
    }
  ],
  searchRoute: $route('list'),

  async fetch({ args, page }) {
    var resp

    var itmes
    if (page == null) {
      resp = await $http.get(`https://lzxlin67vhqpi5cpgg2i.infrobo.com/vod/listing${encodeURI(vod_big_class)}-1?serial=40b90322&s_device_id=c9f7717eee8c`+Math.ceil(Math.random()*1000))
      //console.log(Math.ceil(Math.random()*100))
    } else {
      resp = await $http.get(`https://lzxlin67vhqpi5cpgg2i.infrobo.com/vod/listing${encodeURI(vod_big_class)}-${page || 1}?serial=40b90322&s_device_id=c9f7717eee8c`+Math.ceil(Math.random()*1000))
      //console.log(page)
    }
    itmes = resp.data.data.vodrows.map(data => ({
      style: 'live',
      title: data.title,
      image: data.coverpic,
      route: $route('xj/detail', {
        id: data.play_url,
        title:data.title,
        type: 'ym',
        detailimage: data.coverpath
      })
    }))
    return {
      nextPage: (page || 1) + 1,
      items: itmes
    }
  }
}
